const {Article} = require('../../model/article');
const pagination = require('mongoose-sex-page');
module.exports = async (req,res)=>{
    //记录当前访问的页面
    const page = req.query.page;
    req.app.locals.currentLink = 'article';
    let articles = await pagination(Article).find().page(page).size(2).display(3).populate('author').exec();
    // const articles = await Article.find();
    let result = JSON.stringify(articles);
    articles = JSON.parse(result);
    //  res.send(articles);
     res.render('admin/article',{
         articles
     })
}